package com.seashell.appstartupjob.job;

import com.seashell.appstartupjob.config.IJobConfig;
import com.seashell.appstartupjob.config.JarFileTransJobConfig;
import com.seashell.appstartupjob.config.parser.IJobConfigParser;
import com.seashell.appstartupjob.config.parser.JarFileTransJobConfigParser;
import com.seashell.appstartupjob.worker.IJobWorker;
import com.seashell.appstartupjob.worker.JarFileTransWorker;
import org.dom4j.Element;


/**
 * ServletJarFileTransJob
 * JarFile移动工作类
 *
 * @author Allen
 * @version v1.0
 * @date 2017/7/14
 */
public class ServletJarFileTransJob extends AbstractJarRefJob {

    public ServletJarFileTransJob(String jobName, Element configNode) {
        super(jobName, configNode);
    }

    public ServletJarFileTransJob(String jobName, Class<? extends IJobConfigParser> parserClass, Element configNode) {
        super(jobName, parserClass, configNode);
    }

    @Override
    protected IJobWorker getDefaultWorker() {
        return new JarFileTransWorker();
    }

    @Override
    protected IJobConfigParser getDefaultParser() {
        return new JarFileTransJobConfigParser();
    }

    @Override
    protected String getDefaultJobName() {
        return "ServletJarFileTransJob";
    }

    @Override
    protected void doBeforeWork(IJobConfig config, IJobWorker worker) {
        JarFileTransJobConfig jarFileTransJobConfig = (JarFileTransJobConfig) config;
        jarFileTransJobConfig.setJarRefClass(this.jarRefClass);
    }

}
